package com.aptemo.webetek.server.handlers;

import java.util.ArrayList;

import com.aptemo.webetek.client.commands.Action;
import com.aptemo.webetek.client.commands.impl.GetLabelsAction;
import com.aptemo.webetek.client.commands.responses.ListResponse;
import com.aptemo.webetek.client.exceptions.BackendException;
import com.aptemo.webetek.server.datastore.DataStoreAPI;
import com.aptemo.webetek.shared.LabelBean;

public class LabelsHandler
		extends ActionHandler<GetLabelsAction, ListResponse<LabelBean>>
{

	public LabelsHandler(DataStoreAPI service)
	{
		super(service);
	}

	public Class<? extends Action<?>> getActionType()
	{
		return GetLabelsAction.class;
	}

	@Override
	public ListResponse<LabelBean> invoke(GetLabelsAction action) throws BackendException
	{
		return new ListResponse<LabelBean>((ArrayList<LabelBean>) dataService.getLabels(action.getTeamId()));
		// return new
		// GetLabelsResponse(mparent.getBetLabels(action.getTeamId()));
	}

}
